/*
 * Task.h
 *
 *  Created on: Oct 18, 2012
 *      Author: David Kadlecek, Ales Fiser
 */
#include "general.h"

#ifndef TASK_H_
#define TASK_H_

class Task {
private:
	int my_rank2;
	int16_t* actualState;
	int16_t* maxJob;
	int numOfNodes;
	int depth;
	int16_t lastExpandMovementIndex;
	bool isSolved;

	void logPrintTask();
	void logSplitTask(int changeLevel);
	void init();
	void logBuffer(int16_t* buffer);
	bool haveEnoughToSplit();

public:
	void receiveNewOne(MPI_Status* p_status);
	Task(int numberOfNodes);
	virtual ~Task();
	void nexByInreaseDepth();
	void decreaseDepth();
	void nextByWidth();
	void createFullTask();
	void splitAndSend(int destination, int* p_isTokenDirty);
	bool haveWork();
	int16_t* getActualState();
	int getDepth();
	void setTaskSolved();
	int getLastExpandMovementIndex();
};

#endif /* TASK_H_ */
